package top.shaozuo.simple.configuration.microprofile.config.source;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.eclipse.microprofile.config.spi.ConfigSource;

/**
 * 获取系统环境变量
 * 
 * @author shaozuo
 *
 */
public class OsEnvironmentConfigSource implements ConfigSource {

    /**
     * 环境系统变量
     */
    private final Map<String, String> properties;

    public OsEnvironmentConfigSource() {
        this.properties = new HashMap<>(System.getenv());
        this.properties.put(CONFIG_ORDINAL, "300");
    }

    @Override
    public Set<String> getPropertyNames() {
        return properties.keySet();
    }

    @Override
    public String getValue(String propertyName) {
        return properties.get(propertyName);
    }

    @Override
    public String getName() {
        return "Os Environment Properties";
    }
}
